import { Acquirer } from '@shared/interfaces/acquirer'
import { AcquirerStoreService } from './acquirer-store.service'
import { FormGroup, FormBuilder } from '@angular/forms'

export abstract class AcquirerNewBaseClass {

  acquirer: Acquirer

  validateForm: FormGroup

  constructor(
    public fb: FormBuilder,
    public acquirerStore: AcquirerStoreService,
  ) {
    this.validateForm = this.fb.group({})
    this.initData()
  }

  initData(): void {
    this.acquirerStore
      .value$
      .subscribe(acquirer => {
        this.acquirer = acquirer
      })
  }

  /* 子类有需要就覆盖 */
  checkValid(): boolean {
    this.pushDataToStore()
    return true
  }

  /* 子类去实现 */
  abstract pushDataToStore(): void

}
